//Date.hh
#ifndef DATE_h
#define DATE_h
namespace My_code{
    int leap_year(int n);
    template<typename T> T power(T n,int m)
    {
            if(m == 0)return 1;
            T sum = 1;
            if(m > 0)
            {
                while(m--)
                sum *= n;
            }
            else
            {
                while(m++)
                sum *= n;
                sum = 1.0/sum;
            }
            return sum;
    }
    class Date
    {
        int d,y,m;
        static Date default_day;
    public:
        enum Month{
            jan = 1,
            feb,
            mar,
            apr,
            may,
            jun,
            jul,
            aug,
            sep,
            oct,
            nov,
            dec,
        };
        Date(int,int,int);
        Date(int,Month);
        Date(int);
        Date();
        Date(const char*);//字符串初始化
        Date& Add_year(int n);
        Date& Add_month(int n);
        Date& Add_day(int n);
        inline int day()const
            {
                return d;
            }
        inline Month month() const
            {
                return Month(m);
            }
        inline int year() const
            {
                return y;
            }
        Date(const Date&);
        Date& operator=(const Date&);
        Date& operator-(const Date&);
        void Show();
        static void set_default(int,Month,int);
    };
    class Time{
    public:
        Time(int hh,int mm,int ss);
        Time();
        ~Time();
        void SetTime_h(int h);
        int GetTime_h();
        void SetTime_m(int m);
        int GetTime_m();
        void SetTime_s(int s);
        int GetTime_s();
        void Show();
    protected:
        int m_h,m_m,m_s;
    };
}
#endif
